package cn.tedu.spring.autowired.controller;

import cn.tedu.spring.autowired.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;

/**
 * @author ruoLi
 */
@Controller
public class UserController {
    //属性值的注入
    @Qualifier(value = "userServiceImpl2")
    @Autowired
    private UserService userService;

//    @Autowired
    public void setUserService(UserService userService) {
        this.userService = userService;
    }

//    @Autowired
//    public UserController(/*@Autowired*/ UserService userService) {
//        this.userService = userService;
//    }


    public void controller(){
        System.out.println("controller正在执行...");
        userService.service();
    }

}
